package operation;

import Book.Book;
import Book.Booklist;

import java.util.Scanner;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User:26554
 * Date:2024-11-17
 * Time:13:09
 */
public class AddOperation implements IOPeration {
    public void work(Booklist booklist) {
        System.out.println("新增图书");
        Scanner san = new Scanner(System.in);
        System.out.println("请输入书名");
        String name = san.nextLine();
        System.out.println(name);
        System.out.println("请输入作者名");
        String author = san.nextLine();
        System.out.println(author);
        System.out.println("请输入价格");
        int price = san.nextInt();
        System.out.println(price);
        san.nextLine();
        System.out.println("请输入书的类型");
        String type = san.nextLine();
        System.out.println(type);
        Book book = new Book(name, author, price, type);
        int currentsize = booklist.getActualbooks();
        booklist.setBook(currentsize, book);
        booklist.setActualbooks(currentsize + 1);
        System.out.println("新增成功");
    }
}
